//package com.douqu.game.main.platform;
//
//import com.alibaba.fastjson.JSONObject;
//import com.bean.core.util.HttpStringUtil;
//import com.douqu.game.core.database.model.UserModel;
//import com.douqu.game.core.factory.PlatformFactory;
//import com.douqu.game.core.protobuf.SGCommonProto;
//import com.douqu.game.core.util.LogUtils;
//import com.douqu.game.core.util.CoreUtils;
//import com.douqu.game.main.service.PlayerService;
//import com.douqu.game.core.util.StringUtils;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.stereotype.Component;
//
//import java.text.MessageFormat;
//
///**
// * Author : Bean
// * 2017-05-20 17:07
// */
//@Component
//public class QQImpl implements PlatformSDK {
//
//
//    @Autowired
//    private PlayerService playerService;
//
//    @Override
//    public UserModel login(String account, String password)
//    {
//        LogUtils.info("QQ登录参数:" + account+"  " + password);
//
//        String qqUrl = MessageFormat.format(PlatformFactory.QQ_USERINFO_URL, password, account);
//        String str = HttpStringUtil.sendHttpGet(qqUrl);//https的必须要用这个类的方法，涉及到ssl
////        LogUtils.info("从QQ获取到数据:"+str);
//        JSONObject result = JSONObject.parseObject(str);
//        String nickName = "";
//        int gender = 0;
//        String avatar = "";
//        try{
//            nickName = result.getString("nickname");
//            avatar = result.getString("figureurl_qq_2");
//            String genderName = result.getString("gender");
//        }catch (Exception e){
//            LogUtils.error("1QQ获取数据失败:" + account);
//            e.printStackTrace();
//            return new UserModel();
//        }
//
//        if(StringUtils.isNullOrEmpty(nickName) || StringUtils.isNullOrEmpty(avatar))
//        {
//            LogUtils.error("2QQ获取数据失败:" + account);
//            return new UserModel();
//        }
//
//        account = CoreUtils.createAccount(account, SGCommonProto.E_CHANNEL_TYPE.CHANNEL_TYPE_QQ);
//        UserModel player = playerService.getUserByAccount(account);
//
//        return player;
//    }
//
//
//}
